import urllib
import requests
import json

host_name = "https://www.shanbay.com";
douban_category_url = host_name + "/api/v1/vocabtest/category";
douban_words_url = host_name + "/api/v1/vocabtest/vocabularies/?category=CET6";

category_res = requests.get(douban_category_url)

words_res = requests.get(douban_words_url)
# print(words_res.text) # 自动按默认utf-8解码

json_result = json.loads(words_res.text)  # dict类型
# print(json_result)

if json_result['msg'] == 'SUCCESS':
    data = json_result['data']
    if len(data) > 0:
        n = 0
        length = len(data)
        while n < length:
            # print(data[n])
            item = data[n]
            n += 1
            print(str(n) + "  ===>   " + item['content'])
